import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:todo_app/hooks/GlobalRtcVideoController.dart';
import 'package:todo_app/layout/Gaps.dart';
import 'components/Overlay/main.dart';
import 'constants/DColor.dart';
import 'routes.dart';
import 'package:flutter_localizations/flutter_localizations.dart';

class MyApp extends HookWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    useGlobalRtcVideoController();
    return OverlaySupport(
      navigatorKey: rootNavigatorState,
      child: DefaultTextStyle(
        style: TextStyle(
          fontSize: 12.dp,
          color: DColor.text,
          decoration: TextDecoration.none
        ),
        child: MaterialApp.router(
          title: '待办任务',
          routerConfig: router,
          localizationsDelegates: const [
            GlobalMaterialLocalizations.delegate,
            GlobalWidgetsLocalizations.delegate,
            GlobalCupertinoLocalizations.delegate,
          ],
          supportedLocales: const [
            Locale('en'), // English
            Locale.fromSubtags(languageCode: 'zh', countryCode: 'CN'), // Chinese
          ],
          theme: ThemeData(
            primarySwatch: DColor.primaryColor,
            colorScheme: ColorScheme.fromSeed(seedColor: DColor.primary),
            scaffoldBackgroundColor: DColor.bgColor
          )
        )
      )
    );
  }
}
